/**
 * Copyright 2025 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */

@import url("./spectrum-split-view.css");
@import url("./split-view-overrides.css");

:host {
    --spectrum-split-view-first-pane-size: 50%;
}

::slotted(*) {
    overflow: auto;
}

::slotted(:first-child) {
    order: 1;
}

:host(:not([vertical])) ::slotted(:first-child:not(:last-child)) {
    width: var(--spectrum-split-view-first-pane-size);
}

:host([vertical]) ::slotted(:first-child:not(:last-child)) {
    height: var(--spectrum-split-view-first-pane-size);
}

::slotted(:nth-child(2)) {
    order: 3;
    flex: 1;
}

::slotted(:nth-child(n + 3)) {
    display: none;
}

#gripper {
    touch-action: none;
}

#splitter {
    order: 2;
    height: auto; /* for horizontal splitviews without proper outter height value */
}

:host([resizable]) #splitter {
    background-clip: content-box;
    cursor: ew-resize;
}

:host([vertical][resizable]) #splitter {
    background-clip: content-box;
    cursor: ns-resize;
}

:host([resizable][dir="ltr"]) #splitter.is-resized-start,
:host([resizable][dir="rtl"]) #splitter.is-resized-end {
    cursor: e-resize;
}

:host([resizable][dir="ltr"]) #splitter.is-resized-end,
:host([resizable][dir="rtl"]) #splitter.is-resized-start {
    cursor: w-resize;
}

:host([vertical][resizable]) #splitter.is-resized-start {
    cursor: s-resize;
}

:host([vertical][resizable]) #splitter.is-resized-end {
    cursor: n-resize;
}

:host([resizable][collapsible]) #splitter.is-resized-start,
:host([resizable][collapsible]) #splitter.is-resized-end {
    cursor: ew-resize;
}

:host([resizable][dir="ltr"][collapsible]) #splitter.is-collapsed-start,
:host([resizable][dir="rtl"][collapsible]) #splitter.is-collapsed-end {
    cursor: e-resize;
}

:host([resizable][dir="ltr"][collapsible]) #splitter.is-collapsed-end,
:host([resizable][dir="rtl"][collapsible]) #splitter.is-collapsed-start {
    cursor: w-resize;
}

:host([vertical][resizable][collapsible]) #splitter.is-collapsed-start {
    cursor: s-resize;
}

:host([vertical][resizable][collapsible]) #splitter.is-collapsed-end {
    cursor: n-resize;
}

:host([vertical][resizable][collapsible]) #splitter.is-resized-start,
:host([vertical][resizable][collapsible]) #splitter.is-resized-end {
    cursor: ns-resize;
}
